package com.ruyiadmin.springboot.service_layer.implementations.business_implementations.module_management;

import com.ruyiadmin.springboot.common_infrastructure.models.QueryResponseResult;
import com.ruyiadmin.springboot.entity_data_model.entity_model.business_model.module_management.BizModule;
import com.ruyiadmin.springboot.repository_layer.business_repositories.module_management.IBizModuleRepository;
import com.ruyiadmin.springboot.service_layer.interfaces.business_interfaces.module_management.IBizModuleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 模块表 服务实现类
 * </p>
 *
 * @author RuYiAdmin
 * @since 2022-07-12
 */
@Service
@RequiredArgsConstructor
public class BizModuleServiceImpl extends ServiceImpl<IBizModuleRepository, BizModule> implements IBizModuleService {

    //region 实现类私有属性

    private final IBizModuleRepository bizModuleRepository;

    //endregion

    //region 查询无权限模块列表

    /**
     * 查询无权限模块列表
     *
     * @param userId 用户编号
     * @return QueryResult
     */
    @Override
    public QueryResponseResult<BizModule> queryUserNonModules(String userId) {
        List<BizModule> list = this.bizModuleRepository.queryUserNonModules(userId);
        return QueryResponseResult.success(list.size(), list);
    }

    //endregion
}
